﻿using System;
using System.Collections.Generic;
using System.Text;
using UMC.Web;
using UMC.WorkFlow.Entities;

namespace UMC.WorkFlow
{
    [Apiumc("WorkFlow", "MappSelect", Auth = WebAuthType.Admin, Desc = "选择选项配置")]
    class WorkFlowMappSelectActivity : UMC.Web.WebActivity
    {
        public override void ProcessActivity(WebRequest request, WebResponse response)
        {
            var key = this.AsyncDialog("Key", g => this.DialogValue("Promotion"));

            var TId = UMC.Data.Utility.UInt64Parse(this.AsyncDialog("Id", g =>
            {
                var grid = new TaskKeyDialog()
                {
                    Title = "选项配置字典",
                    CloseEvent = "UI.Event",
                    IsSearch = true
                };

                return grid;
            })) ?? 0;
            var tKey = DataFactory.Instance().TaskKey(TId);

            if (tKey != null)
            {
                this.Context.UIEvent(key, new ListItem() { Value = String.Format("WorkFlow.Control.{0}", tKey.Code), Text = tKey.Caption }, true);
            }
            this.Context.UIEvent(key, new ListItem() { Value = "none", Text = "none" }, true);

            
        }
    }
}
